(function (global, factory) {
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  typeof define === 'function' && define.amd ? define([], factory) :
  global.math = factory();
}(this, function () { 'use strict';

  return {
    degree2radian: function(degree) {
      return degree * (Math.PI / 180);
    },
    cos: function(degree) {
      return Math.cos(this.degree2radian(degree));
    },
    sin: function(degree) {
      return Math.sin(this.degree2radian(degree));
    },
    vectorLength: function(x, y) {
      return Math.sqrt(x * x + y * y);
    },
    vector3Length: function(x, y, z) {
      return Math.sqrt(x * x + y * y + z * z);
    },
    arithmeticSequence: function(a1, d, n) {
      a1 = a1 || 0;
      d = d || 1;
      n = n || 9;
      let ret = [];
      for (var i = 0; i < n; i++) {
        ret.push(a1 + d * i);
      }
      return ret;
    },
    geometricSequence: function(a1, d, n) {
      a1 = a1 || 1;
      d = d || 1;
      n = n || 9;
      let ret = [];
      for (var i = 0; i < n; i++) {
        ret.push(a1 * d * i);
      }
      return ret;
    }
  }

}))
